<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/perfiles/directorOperativo/ruta/plantillaRuta.xhtml">
        <ui:define name="titulo">
            <br />
            <h:outputText value="#{bundle.PreEditRutaTitle}"></h:outputText>
            <br />
        </ui:define>
               
        <ui:define name="contenido">
            <h:form> 
                #{bundle.SearchedRuta_instruction}
                <h:panelGrid columns="3" cellspacing="8">
                    <h:outputLabel value="#{bundle.SearchedRutaLabel_currentRuta}" for="nombreRuta" />
                    <h:inputText id="nombreRuta" value="#{rutaController.selected.nombreRuta}" title="#{bundle.SearchedRutaTitle_currentRuta}" required="true" requiredMessage="#{bundle.SearchedRutaRequiredMessage_currentRuta}"/>
                    <h:commandButton action="#{rutaController.prepareResultList}" value="#{bundle.SearchedRutaBuscarButton}"/>
                    <h:message for="nombreRuta" styleClass="error"></h:message>                    
                </h:panelGrid>                
                <br />   
                <h:outputText escape="false" value="#{bundle.ListRutaEmpty}" rendered="#{rutaController.getItems(2).rowCount == 0 and !rutaController.inicioBusqueda}"
                              styleClass="paginacion"/>
                <h:panelGroup rendered="#{rutaController.getItems(2).rowCount > 0}">
                    <h:outputText value="#{rutaController.pagination.pageFirstItem + 1}-#{rutaController.pagination.pageLastItem + 1} / #{rutaController.pagination.itemsCount}"
                                  styleClass="paginacion"/>&nbsp;
                    <h:commandLink action="#{rutaController.previousPreGestionList(3)}" value="#{bundle.Previous}" rendered="#{rutaController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{rutaController.nextPreGestionList(3)}" value="#{bundle.Next}" rendered="#{rutaController.pagination.hasNextPage}"/>&nbsp;
                    <h:dataTable value="#{rutaController.getItems(2)}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="lista_odd_row,lista_even_row" rules="all" styleClass="lista_form">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRutaTitle_codigoRuta}"/>
                            </f:facet>
                            <h:outputText value="#{item.codigoRuta}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRutaTitle_nombreRuta}"/>
                            </f:facet>
                            <h:outputText value="#{item.nombreRuta}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRutaTitle_descripcionRuta}"/>
                            </f:facet>
                            <h:outputText value="#{item.descripcionRuta}"/>
                        </h:column> 
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRutaTitle_estadoRuta}"/>
                            </f:facet>
                            <h:outputText value="#{item.estadoRuta}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{rutaController.prepareGestion(3)}" value="#{bundle.ListRutaViewLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{rutaController.prepareGestion(0)}" value="#{bundle.ListRutaEditLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{rutaController.prepareGestion(1)}" value="#{bundle.ListRutaEstadoLink}"/>
                        </h:column>
                    </h:dataTable>
                </h:panelGroup>    
            </h:form>
        </ui:define>
    </ui:composition>

</html>
